Repository navigation
feat(reports): a report's PDF can be 500 MB - #1700
Conversation
Measured on 500 MB PDFs of 100, 1,000 and 4,000 pages under the backend's 4 GB heap: reading, the byline page and its full rewrite take at most 516 MB of heap and 2.65 GB of memory in all, a few seconds each. Only reports change: extraction and the assistant keep their 100 MB. A scan past 100 MB, which has no text to read, is no longer given to the reader whole, whose base64 would pass what a string can hold: the author types its details in. A PDF read from R2 is held once, in the answer's own buffer. Part of #1695.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad9e0e4335
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…text asks the model nothing
A report's PDF can now be 500 MB, up from 100 MB. It uploads straight to R2 since #1699. The owner asked to make sure it can actually be read within the server's memory. Part of #1695.
Measured first
The dev backend runs every Node action in one Node 22 process, with the default 4 GB heap limit and about 2 GB already in use. The container has no memory limit, and the host had 88 GB free.
The repository's own code was run on generated 500 MB PDFs with that heap limit:
Each step takes a few seconds. The memory is mostly the file's own buffers, which sit outside the heap limit.
What changes
REPORT_PDF_MB = 500sets the upload limit,attachPdf's refusal and the Publish page's check and hint. Extraction and the assistant keep 100 MB.Checks
npx tsc --noEmit,check:convex-rulesnpx vitest run convex/reports convex/files convex/migrations lib/reports: 308 passed, including a new test that a scan past the limit sends nothing to the modelAfter merge
A 500 MB PDF gets uploaded and read on dev in a browser, with the backend's memory watched while it runs.